<template>
	<view>
		<image :src="img" mode="aspectFit"></image>
		<view class="h4">公司简介</view>
		<view class="content">
			{{c_message}}
		</view>
	</view>
</template>

<script>
	import request from "@/myutil/my.js"
	const {
		Parser
	} = require('htmlparser2');

	export default {
		data() {
			return {
				img: '',
				c_message: ''
			}
		},
		onLoad() {
			this.getMessage();
		},
		methods: {
			getMessage() {
				request.get('https://baiyi.kent.work/api/v1/system/getCompanyInfoWx')
					.then(res => {
						this.img = res.data.images_list[0]
						const parser = new Parser({
							ontext: text => {
								this.c_message += text;
							}
						});
						parser.write(res.data.content);
						parser.end();
					}).catch(err => {
						console.log('请求失败：', err)
					})

			}
		}
	}
</script>

<style scoped lang="scss">
	image {
		width: 100vw;
	}
	.h4 {
		width: 140rpx;
		margin: 0 auto;
		border-radius: 30rpx;
		color: #fff;
		text-align: center;
		background-color: #18bc37;
	}
	.content {
		padding: 20rpx 10rpx;
		font-size: 32rpx;
	}
</style>
